+2005-08-22 Øyvind Kolås <pippin@gimp.org>
+
+ * babl/babl-classes.h: (BabPixelFormat): only a single BablModel.
+ * babl/babl-fish.h,
+ * babl/babl-pixel-format.h,
+ * tests/babl-html-dump.c: accomodate change.
+
2005-08-21 Øyvind Kolås <pippin@gimp.org>
* docs/.cvsignore: added Makefile and Makefile.in
BablConversion **to; /*< NULL terminated list of conversions to class */
int bands;
int planar;
- BablModel **model;
+ BablModel *model;
BablComponent **component;
BablType **type;
BablSampling **sampling;
babl->reference_fish.model_to_rgba =
babl_conversion_find (
- source->pixel_format.model[0],
+ source->pixel_format.model,
babl_model_id (BABL_RGBA)
);
babl->reference_fish.rgba_to_model =
babl_conversion_find (
babl_model_id (BABL_RGBA),
- destination->pixel_format.model[0]
+ destination->pixel_format.model
);
babl->reference_fish.double_to_type =
babl->reference_fish.model_to_rgba =
babl_conversion_find (
- source->pixel_format.model[0],
+ source->pixel_format.model,
babl_model_id (BABL_RGBA)
);
babl->reference_fish.rgba_to_model =
babl_conversion_find (
babl_model_id (BABL_RGBA),
- destination->pixel_format.model[0]
+ destination->pixel_format.model
);
babl->reference_fish.double_to_type =
/* calculate planar representation of fooA, and fooB */
- imageA = babl_image_new_from_linear (fooA, BABL(BABL((babl->fish.source)) -> pixel_format.model[0]));
+ imageA = babl_image_new_from_linear (fooA, BABL(BABL((babl->fish.source)) -> pixel_format.model));
imageB = babl_image_new_from_linear (fooB, babl_model_id (BABL_RGBA));
/* transform fooA into fooB fooB is rgba double */
/* transform fooB into fooC fooC is ???? double */
imageB = babl_image_new_from_linear (fooB, babl_model_id (BABL_RGBA));
- imageC = babl_image_new_from_linear (fooA, BABL(BABL((babl->fish.destination))->pixel_format.model[0]));
+ imageC = babl_image_new_from_linear (fooA, BABL(BABL((babl->fish.destination))->pixel_format.model));
babl->reference_fish.rgba_to_model->function.planar(
imageB->image.bands,
int id,
int planar,
int bands,
- BablModel **model,
+ BablModel *model,
BablComponent **component,
BablSampling **sampling,
BablType **type)
/* allocate all memory in one chunk */
babl = babl_calloc (sizeof (BablPixelFormat) +
strlen (name) + 1 +
- sizeof (BablModel*) * (bands+1) +
sizeof (BablComponent*) * (bands+1) +
sizeof (BablSampling*) * (bands+1) +
sizeof (BablType*) * (bands+1) +
sizeof (int) * (bands+1) +
sizeof (int) * (bands+1),1);
- babl->pixel_format.model = ((void *)babl) + sizeof (BablPixelFormat);
- babl->pixel_format.component = ((void *)babl->pixel_format.model) + sizeof (BablModel*) * (bands+1);
+ babl->pixel_format.component = ((void *)babl) + sizeof (BablPixelFormat);
babl->pixel_format.type = ((void *)babl->pixel_format.component) + sizeof (BablComponent*) * (bands+1);
babl->pixel_format.sampling = ((void *)babl->pixel_format.type) + sizeof (BablType*) * (bands+1);
babl->instance.name = ((void *)babl->pixel_format.sampling) + sizeof (BablSampling*) * (bands+1);
babl->instance.id = id;
strcpy (babl->instance.name, name);
- babl->pixel_format.bands = bands;
- babl->pixel_format.planar = planar;
+ babl->pixel_format.model = model;
+ babl->pixel_format.bands = bands;
+ babl->pixel_format.planar = planar;
for (band=0; band < bands; band++)
{
- babl->pixel_format.model[band] = model[band];
babl->pixel_format.component[band] = component[band];
babl->pixel_format.type[band] = type[band];
babl->pixel_format.sampling[band] = sampling[band];
}
- babl->pixel_format.model[band] = NULL;
babl->pixel_format.component[band] = NULL;
babl->pixel_format.type[band] = NULL;
babl->pixel_format.sampling[band] = NULL;
int id = 0;
int planar = 0;
int bands = 0;
- BablModel *model [BABL_MAX_BANDS];
+ BablModel *model = NULL;
BablComponent *component [BABL_MAX_BANDS];
BablSampling *sampling [BABL_MAX_BANDS];
BablType *type [BABL_MAX_BANDS];
BablSampling *current_sampling = (BablSampling*) babl_sampling (1,1);
BablType *current_type = (BablType*) babl_type_id (BABL_U8);
- BablModel *current_model = NULL;
const char *arg = name;
va_start (varg, name);
current_type = (BablType*) babl;
break;
case BABL_COMPONENT:
- if (!current_model)
+ if (!model)
{
babl_log ("%s(): no model specified before component %s",
__FUNCTION__, babl->instance.name);
}
- model [bands] = current_model;
component [bands] = (BablComponent*) babl;
type [bands] = current_type;
sampling [bands] = current_sampling;
current_sampling = (BablSampling*)arg;
break;
case BABL_MODEL:
- current_model = (BablModel*)arg;
+ if (model)
+ {
+ babl_log ("%s(%s): model %s already requested",
+ __FUNCTION__, babl->instance.name, model->instance.name);
+ }
+ model = (BablModel*)arg;
break;
case BABL_INSTANCE:
case BABL_PIXEL_FORMAT:
babl = pixel_format_new (name, id,
- planar,
- bands,
- model, component, sampling, type);
+ planar, bands, model,
+ component, sampling, type);
if (db_insert (babl) == babl)
int id,
int planar,
int bands,
- BablModel **model,
+ BablModel *model,
BablComponent **component,
BablSampling **sampling,
BablType **type)
/* allocate all memory in one chunk */
babl = babl_calloc (sizeof (BablPixelFormat) +
strlen (name) + 1 +
- sizeof (BablModel*) * (bands+1) +
sizeof (BablComponent*) * (bands+1) +
sizeof (BablSampling*) * (bands+1) +
sizeof (BablType*) * (bands+1) +
sizeof (int) * (bands+1) +
sizeof (int) * (bands+1),1);
- babl->pixel_format.model = ((void *)babl) + sizeof (BablPixelFormat);
- babl->pixel_format.component = ((void *)babl->pixel_format.model) + sizeof (BablModel*) * (bands+1);
+ babl->pixel_format.component = ((void *)babl) + sizeof (BablPixelFormat);
babl->pixel_format.type = ((void *)babl->pixel_format.component) + sizeof (BablComponent*) * (bands+1);
babl->pixel_format.sampling = ((void *)babl->pixel_format.type) + sizeof (BablType*) * (bands+1);
babl->instance.name = ((void *)babl->pixel_format.sampling) + sizeof (BablSampling*) * (bands+1);
babl->instance.id = id;
strcpy (babl->instance.name, name);
- babl->pixel_format.bands = bands;
- babl->pixel_format.planar = planar;
+ babl->pixel_format.model = model;
+ babl->pixel_format.bands = bands;
+ babl->pixel_format.planar = planar;
for (band=0; band < bands; band++)
{
- babl->pixel_format.model[band] = model[band];
babl->pixel_format.component[band] = component[band];
babl->pixel_format.type[band] = type[band];
babl->pixel_format.sampling[band] = sampling[band];
}
- babl->pixel_format.model[band] = NULL;
babl->pixel_format.component[band] = NULL;
babl->pixel_format.type[band] = NULL;
babl->pixel_format.sampling[band] = NULL;
int id = 0;
int planar = 0;
int bands = 0;
- BablModel *model [BABL_MAX_BANDS];
+ BablModel *model = NULL;
BablComponent *component [BABL_MAX_BANDS];
BablSampling *sampling [BABL_MAX_BANDS];
BablType *type [BABL_MAX_BANDS];
BablSampling *current_sampling = (BablSampling*) babl_sampling (1,1);
BablType *current_type = (BablType*) babl_type_id (BABL_U8);
- BablModel *current_model = NULL;
const char *arg = name;
va_start (varg, name);
current_type = (BablType*) babl;
break;
case BABL_COMPONENT:
- if (!current_model)
+ if (!model)
{
babl_log ("%s(): no model specified before component %s",
__FUNCTION__, babl->instance.name);
}
- model [bands] = current_model;
component [bands] = (BablComponent*) babl;
type [bands] = current_type;
sampling [bands] = current_sampling;
current_sampling = (BablSampling*)arg;
break;
case BABL_MODEL:
- current_model = (BablModel*)arg;
+ if (model)
+ {
+ babl_log ("%s(%s): model %s already requested",
+ __FUNCTION__, babl->instance.name, model->instance.name);
+ }
+ model = (BablModel*)arg;
break;
case BABL_INSTANCE:
case BABL_PIXEL_FORMAT:
babl = pixel_format_new (name, id,
- planar,
- bands,
- model, component, sampling, type);
+ planar, bands, model,
+ component, sampling, type);
if (db_insert (babl) == babl)
}
printf ("</td>");
printf ("<td valign='top'>");
- printf ("<span class='name'>%s</span>", BABL(babl->pixel_format.model[0])->instance.name );
+ printf ("<span class='name'>%s</span>", BABL(babl->pixel_format.model)->instance.name );
printf ("</td>");
printf ("<td>");
for (i=0; i< babl->pixel_format.bands; i++)